home *** CD-ROM | disk | FTP | other *** search
- Path: news.islandnet.com!usenet
- From: jklinke@islandnet.com (Jason Klinke)
- Newsgroups: comp.lang.c
- Subject: Loop Invariant
- Date: 24 Jan 1996 01:42:08 GMT
- Organization: Digital Reality Inc.
- Message-ID: <4e42pg$2oq@sanjuan.islandnet.com>
- Reply-To: jklinke@uvaix.uvic.ca
- NNTP-Posting-Host: protection.islandnet.com
- X-Newsreader: WinVN 0.92.2
-
- I'm having difficulty coming up with a loop invariant that I can prove, for
- the following code which computes the sum of the integers in the array
- A[0..n-1] :
-
- -----------
- sum = 0;
- for (i = 0; i < n; i++)
- sum = sum + A[i];
- -----------
-
- Any help with this invariant and its proof is appreciated.
-
- Jason.
-
-